package com.shuai.blog.service;

import com.shuai.blog.entity.CommentInfo;
import com.shuai.blog.mapper.CommentMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CommentService {
    @Resource
    private CommentMapper commentMapper;

    /**
     * 根据文章id获取评论信息
     */
    public List<CommentInfo> commentsList(Integer artId) {
        return commentMapper.commentsList(artId);
    }

    /**
     * 向评论表中新增数据 -- 评论内容、文章id、作者信息
     */
    public int addComment(CommentInfo commentInfo) {
        return commentMapper.addComment(commentInfo);
    }

}
